home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / quad / Quad_UnsToDouble.c < prev   
Encoding:
C/C++ Source or Header  |  1991-03-18  |  1.2 KB  |  47 lines

  1. /* 
  2.  * Quad_UnsToDouble.c --
  3.  *
  4.  *    Quad_UnsToDouble libc routine.
  5.  *
  6.  * Copyright 1991 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that this copyright
  10.  * notice appears in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/lib/c/quad/RCS/Quad_UnsToDouble.c,v 1.1 91/03/18 12:21:15 kupfer Exp $ SPRITE (Berkeley)";
  18. #endif /* not lint */
  19.  
  20. #include <quad.h>
  21.  
  22.  
  23. /*
  24.  *----------------------------------------------------------------------
  25.  *
  26.  * Quad_UnsToDouble --
  27.  *
  28.  *    Convert an unsigned quad to a double.
  29.  *
  30.  * Results:
  31.  *    Returns a double that is approximately equal to the given 
  32.  *    integer. 
  33.  *
  34.  * Side effects:
  35.  *    None.
  36.  *
  37.  *----------------------------------------------------------------------
  38.  */
  39.  
  40. double
  41. Quad_UnsToDouble(q)
  42.     u_quad q;
  43. {
  44.     return ((double)0xffffffff + 1) * q.val[QUAD_MOST_SIG]
  45.         + q.val[QUAD_LEAST_SIG];
  46. }
  47.